import { MockMethod } from 'vite-plugin-mock';

export default [
  {
    url: '/mock/api/login',
    timeout: 1000,
    method: 'post',
    response: ({ body }) => {
      return {
        code: 200,
        message: 'ok',
        data: {
          token: `${body.username}_@string`
        }
      };
    }
  },
  {
    url: '/mock/api/userInfo',
    timeout: 200,
    method: 'get',
    response: (options) => {
      const role = options.headers.authorization.split('_')[0];
      const roleName = role === 'admin' ? '系统管理员' : '普通用户';
      return {
        code: 200,
        message: 'ok',
        data: {
          username: roleName,
          role: role
        }
      };
    }
  },
  {
    url: '/mock/api/menuList',
    timeout: 200,
    method: 'get',
    response: () => {
      return {
        code: 200,
        message: 'ok',
        data: [
          {
            id: 1,
            title: '首页',
            path: '/dashboard',
            icon: 'el-icon-odometer'
            // hidden: 0,
            // sort: 6,
            // type: 0
          },

          {
            id: 2,
            title: '机构管理',
            path: '/cooperation',
            component: '/cooperation/list/index',
            icon: 'el-icon-setting'
            // hidden: 0,
            // sort: 5,
            // type: 0
          },
          {
            id: 3,
            title: '检测点管理',
            path: '/checkPoint',
            icon: 'el-icon-setting'
            // hidden: 0,
            // sort: 4,
            // type: 0
          },
          {
            id: 4,
            title: '设备管理',
            path: '/checkPointEquipment',
            icon: 'el-icon-setting'
            // hidden: 0,
            // sort: 3,
            // type: 0
          },
          {
            id: 5,
            title: '健康顾问管理',
            path: '/healthConsultant',
            icon: 'el-icon-setting'
            // hidden: 0,
            // sort: 2,
            // type: 0
          },
          {
            id: 6,
            title: '用户管理',
            path: '/user',
            icon: 'el-icon-setting'
            // hidden: 0,
            // sort: 1,
            // type: 0
          },
          {
            id: 7,
            title: '福娃AI报告管理',
            path: '/APMReport',
            component: '/APMReport/menu',
            icon: 'el-icon-Tickets'
            // hidden: 0,
            // sort: 6,
            // type: 0
          },
          {
            id: 8,
            title: '系统设置',
            path: '/system',
            component: '',
            icon: 'el-icon-setting',
            // hidden: 0,
            // sort: 1,
            // type: 0,
            children: [
              {
                id: 81,
                title: '员工管理',
                path: '/system/staff'
                // icon: '',
                // hidden: 0,
                // sort: 0,
                // type: 1
              },
              {
                id: 83,
                title: '套餐管理',
                path: '/system/package'

                // icon: '',
                // hidden: 0,
                // sort: 0,
                // type: 1
              },
              {
                id: 82,
                title: '角色管理',
                path: '/system/role'
                // icon: '',
                // hidden: 0,
                // sort: 0,
                // type: 1
              }
            ]
          },
          {
            id: 9,
            pid: 0,
            title: 'test',
            path: '/myTest',
            icon: 'el-icon-setting',
            hidden: 0,
            sort: 8,
            type: 0
          }
        ]
      };
    }
  }
] as MockMethod[];
